/******************************************************************************
*  Filename:       rf_patch_cpe_multi_protocol_rtls.c
*
*  Description: RF core patch for multi-protocol support (all available API command sets) with RTLS components in CC13x2 and CC26x2
*
*  Copyright (c) 2015-2020, Texas Instruments Incorporated
*  All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without
*  modification, are permitted provided that the following conditions are met:
*
*  1) Redistributions of source code must retain the above copyright notice,
*     this list of conditions and the following disclaimer.
*
*  2) Redistributions in binary form must reproduce the above copyright notice,
*     this list of conditions and the following disclaimer in the documentation
*     and/or other materials provided with the distribution.
*
*  3) Neither the name of the ORGANIZATION nor the names of its contributors may
*     be used to endorse or promote products derived from this software without
*     specific prior written permission.
*
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
*  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
*  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
*  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
*  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
*  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
*  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*  POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

#include <stdint.h>
#include <string.h>

#include "rf_patch_cpe_multi_protocol_rtls.h"

#ifndef CPE_PATCH_TYPE
#define CPE_PATCH_TYPE static const uint32_t
#endif

#ifndef SYS_PATCH_TYPE
#define SYS_PATCH_TYPE static const uint32_t
#endif

#ifndef PATCH_FUN_SPEC
#define PATCH_FUN_SPEC static
#endif

#ifndef _APPLY_PATCH_TAB
#define _APPLY_PATCH_TAB
#endif


CPE_PATCH_TYPE patchImageMultiProtocolRtls[] = {
   0x21004099,
   0x2100492d,
   0x210049b5,
   0x210040b5,
   0x21004ba3,
   0x210040ed,
   0x21004157,
   0x21004119,
   0x21004c75,
   0x21004cb1,
   0x2100417d,
   0x21004189,
   0x21004195,
   0x21004d3d,
   0x210041c9,
   0x210041e1,
   0x210041f9,
   0x21004235,
   0x21004d97,
   0xd00507db,
   0xf803f000,
   0x70084902,
   0xb570bd70,
   0x47284d01,
   0x210004e0,
   0x0002241d,
   0x68084908,
   0x43902221,
   0x48076008,
   0x68c34700,
   0x230260c3,
   0xd1fd1e5b,
   0x68c32210,
   0x60c34393,
   0x4770618a,
   0x40048000,
   0x00005c01,
   0x4801b430,
   0x00004700,
   0x00020efd,
   0x79654c07,
   0xf809f000,
   0x40697961,
   0xd5030749,
   0x4a042101,
   0x60110389,
   0xb570bd70,
   0x47084902,
   0x21000380,
   0x40041108,
   0x0000592d,
   0xf819f000,
   0x296cb2e1,
   0x2804d00b,
   0x2806d001,
   0x490ed107,
   0x07c97809,
   0x7821d103,
   0xd4000709,
   0x490b2002,
   0x210c780a,
   0xd0024211,
   0x22804909,
   0xb003600a,
   0xb5f0bdf0,
   0x4907b083,
   0x48044708,
   0x22407801,
   0x70014391,
   0x47004804,
   0x210000c8,
   0x21000133,
   0xe000e200,
   0x00031641,
   0x00031b23,
   0x4700b570,
   0xfdc0f000,
   0x47004800,
   0x00007f57,
   0xfdc0f000,
   0x47004800,
   0x0000881b,
   0x0a9b9b03,
   0x2b834d08,
   0x4c08d10a,
   0x069b8923,
   0xb407d506,
   0xf805f000,
   0xd0002800,
   0xbc073542,
   0xb5704728,
   0x47004802,
   0x00020b1f,
   0x21000160,
   0x000209eb,
   0x781a4b09,
   0x43a22408,
   0xd0002800,
   0x701a4322,
   0x47104a00,
   0x00008e83,
   0x78084903,
   0xd4010700,
   0x47004802,
   0x00004770,
   0x21000380,
   0x00007e5f,
   0x4a094808,
   0x429a6803,
   0x4808d10a,
   0x4b088902,
   0xd0011ad2,
   0xd1032a01,
   0x49066e40,
   0x99034788,
   0x47184b05,
   0x210002a8,
   0x000203bd,
   0x21000160,
   0x00001821,
   0x000035f1,
   0x000006bd,
   0x20284a04,
   0x48044790,
   0x60412101,
   0x4a044803,
   0x47106041,
   0x0000424f,
   0x40045000,
   0x40046000,
   0x00004285,
   0x21004877,
   0x487775c1,
   0xb5704700,
   0x4d744c74,
   0x6a603c80,
   0xd11d2800,
   0x5d002054,
   0x28002200,
   0x2064d017,
   0x08805d00,
   0xd01207c0,
   0x888868a9,
   0x28010b80,
   0x486cd10d,
   0x08407dc0,
   0xd00807c0,
   0x30204869,
   0x68006980,
   0xd0022800,
   0x60a86229,
   0x622ae000,
   0x47804865,
   0x29006a61,
   0x6a29d103,
   0xd0002900,
   0xbd7060a9,
   0x4c5db5f8,
   0x3c804960,
   0x30404620,
   0x2a007d02,
   0x7e80d02e,
   0x28034d58,
   0x2804d002,
   0xe027d003,
   0x75e82001,
   0x2064e024,
   0x08805d00,
   0xd01f07c0,
   0x888068a8,
   0x28010b80,
   0x4851d11a,
   0x7dc07dea,
   0xd0132a00,
   0x07c008c0,
   0x4626d012,
   0x7b773620,
   0x46014788,
   0xd1084339,
   0x06097d21,
   0x8869d505,
   0x29010b89,
   0x2100d101,
   0xbdf87371,
   0xe7ea0880,
   0xbdf84788,
   0x4c40b5f8,
   0x3c804944,
   0x36204626,
   0x46257b70,
   0x90003540,
   0x00b8792f,
   0x68801840,
   0x28004780,
   0x493ad128,
   0x09097dc9,
   0xd02307c9,
   0x32644622,
   0xd0202f15,
   0x23007e29,
   0x07ff094f,
   0x7d6dd003,
   0xd0002d00,
   0x9f002301,
   0x43bb6fa5,
   0x7b73d012,
   0xd00f2b00,
   0x065b7d23,
   0x88d2d50c,
   0x2a010b92,
   0x08c9d108,
   0xd00507c9,
   0x0b8988a9,
   0xd1012901,
   0x73712100,
   0x7eabbdf8,
   0x2b017de9,
   0x2300d0e3,
   0xb510e7e1,
   0x3c804c1f,
   0x31404621,
   0x28017d08,
   0x481ed134,
   0x08407dc0,
   0xd02f07c0,
   0x30604620,
   0x08527942,
   0xd02907d2,
   0x0b808940,
   0xd1252801,
   0x09417e08,
   0xd00c07c9,
   0x07006fa1,
   0x0fc08809,
   0x04090240,
   0x66604308,
   0x1c806fa0,
   0xfd04f000,
   0x480ee013,
   0x69803020,
   0x28006840,
   0x4a0fd00e,
   0x78012300,
   0x1a5956d3,
   0x00c9d408,
   0x78411808,
   0xd00307c9,
   0x66616801,
   0x66a06840,
   0x47804808,
   0x0000bd10,
   0x210001e0,
   0x00022a15,
   0x210000c8,
   0x00023d8f,
   0x00023075,
   0x00025500,
   0x210004e0,
   0x00024959,
   0x4cf8b570,
   0x5d002044,
   0x008049f7,
   0x68801840,
   0x46054780,
   0xd0112801,
   0x5d00207e,
   0xd30d2805,
   0x06002021,
   0x00897e41,
   0x7f0a1809,
   0xd0072a02,
   0x77082003,
   0x49ed3480,
   0x478888a0,
   0xbd704628,
   0x77012104,
   0x700148ea,
   0xb5ffe7f4,
   0x7e9a4be5,
   0x49e81852,
   0x2182600a,
   0x09895cc9,
   0x49e6d178,
   0x29006909,
   0x680ad074,
   0x0e2e0415,
   0x3560461d,
   0xb2d47eed,
   0xd0222e01,
   0x006d2610,
   0x1eed46b6,
   0x7bdb3320,
   0x2b0146ac,
   0x1412d01e,
   0x4bdbb252,
   0x681b684d,
   0x00a43108,
   0x1f241864,
   0x402b1880,
   0x94023030,
   0x93004ad6,
   0x24019103,
   0x4ad56054,
   0x69142622,
   0x433c2710,
   0x22006114,
   0x2608e032,
   0x46b600ad,
   0xe7db1fad,
   0xe7e01612,
   0x4fcec910,
   0x402b4063,
   0x46239301,
   0x03642401,
   0x4cc8603c,
   0x60603440,
   0x3c404cc6,
   0x1a246864,
   0x4cc6d506,
   0x68273c80,
   0xd40104bf,
   0xe7fabf20,
   0x9c014fbf,
   0x9c02633c,
   0x42a14470,
   0x9903d900,
   0x68644cb9,
   0xd0064234,
   0x3c804cb7,
   0x27026826,
   0x602643be,
   0x1c522600,
   0xd3d14562,
   0x49b59c00,
   0x402c405c,
   0x684a3940,
   0xd4fc1a12,
   0x630448b0,
   0x210048b0,
   0x48b06041,
   0x22106901,
   0x61014391,
   0xe7ffbdff,
   0x212248a8,
   0x420a6842,
   0x49a6d0fc,
   0x68083980,
   0x43902202,
   0xe7f16008,
   0x4d9eb5f3,
   0x5d46202f,
   0xb08148a6,
   0x05806900,
   0x2e011600,
   0x1c40d002,
   0xe0001040,
   0x49a1301e,
   0x6a093140,
   0x4b954aa0,
   0x691a4351,
   0x6a1b0e09,
   0xd0222e01,
   0x01591852,
   0x316731ff,
   0x18544b93,
   0x68d93340,
   0xb2894f94,
   0xb2821a08,
   0x68783f40,
   0xd4fc1b00,
   0x462860da,
   0x90003060,
   0x49898381,
   0x31122050,
   0x35804788,
   0x980180a8,
   0xd0082800,
   0x990278aa,
   0xfadaf000,
   0x1852e007,
   0x31ce0119,
   0x488ae7dc,
   0x99006ac0,
   0x488977c8,
   0x68407829,
   0x08c14348,
   0xd00b2e01,
   0x380f4620,
   0x687a340e,
   0xd4fc1b12,
   0x0c0b4a83,
   0xb2896193,
   0xbdfe6151,
   0x380d4620,
   0xe7f23409,
   0x4c70b570,
   0x35604625,
   0x1e407fa8,
   0xd80d2802,
   0x28006aa0,
   0x2182d004,
   0x70015d09,
   0x62a01c40,
   0x1e406a60,
   0x7fa86260,
   0x77a81cc0,
   0x28057fa8,
   0xd112d322,
   0x28026a60,
   0x4971dd08,
   0x47881e80,
   0x62611c81,
   0xd0012800,
   0xbd702001,
   0x46082100,
   0xff7af7ff,
   0xf7ff2110,
   0x485efee8,
   0x6ac13840,
   0xd0fc07c9,
   0x3880485b,
   0x22026801,
   0x60014311,
   0x8ba84958,
   0x60c83140,
   0x36404626,
   0x49527930,
   0x18400080,
   0x47806880,
   0xd1de2800,
   0x29057fa9,
   0x7fead301,
   0x29047172,
   0x7de1d3d7,
   0xd1022900,
   0x29007e21,
   0x7eead0d1,
   0x015268e1,
   0x60e11889,
   0xb570bd70,
   0x20444d43,
   0x48475d46,
   0x38204942,
   0x00b07ec4,
   0x68801840,
   0x4b4e4780,
   0x781a09a1,
   0xd10a4211,
   0x21ff2221,
   0x76510612,
   0x2200493c,
   0x600a1f09,
   0x2101604a,
   0x212f7019,
   0x29025d49,
   0x2e31d008,
   0x07e1d003,
   0xd0032900,
   0x0861e003,
   0xe7f907c9,
   0x35802400,
   0xbd70706c,
   0x4c2db5f8,
   0x46272500,
   0x723d3760,
   0x5d00202f,
   0xd03a2802,
   0x47804839,
   0x36404626,
   0x7ff0492b,
   0x62203920,
   0x43087849,
   0x48287560,
   0x38406265,
   0x2d007fc5,
   0x7d20d006,
   0x43082120,
   0x06e87520,
   0x72380ec0,
   0x7f30492e,
   0x4a2e4788,
   0xd0112d00,
   0x61c5482d,
   0x20074b1c,
   0x63983b40,
   0x21054d1a,
   0x07806950,
   0x6868d1fc,
   0xd0f94208,
   0x30404825,
   0x63186800,
   0x28007f30,
   0x6e60d001,
   0x6be16210,
   0x47882039,
   0x20006420,
   0x4820bdf8,
   0xb5f0e7fa,
   0x20444909,
   0x2b045c43,
   0x460ad00a,
   0x78103268,
   0x28004f06,
   0x28ffd070,
   0x2b04d03f,
   0xe033d030,
   0x327b460a,
   0x0000e7f3,
   0x21000160,
   0x00025500,
   0x0000423d,
   0x21000020,
   0x40045080,
   0x210000e8,
   0x40022080,
   0x40043040,
   0xe000ed00,
   0xe000e280,
   0x400452c0,
   0x00155556,
   0x40046040,
   0x210002c0,
   0x40045180,
   0x0002175f,
   0x210004e1,
   0x00020749,
   0x00020e45,
   0x40042000,
   0x40042100,
   0x0002469d,
   0x014568cc,
   0x60cc1964,
   0x5c64242f,
   0xd1012c01,
   0x0e000640,
   0x20ff6248,
   0x202f7010,
   0x02004cd6,
   0x4dd56020,
   0x3d406a48,
   0x07d26862,
   0x220fd012,
   0x4ed263aa,
   0x2801e003,
   0x632edd07,
   0x28001e80,
   0x6862dd1a,
   0xd1f607d2,
   0x2007e006,
   0x20ff63a8,
   0xe0116328,
   0xdd0f2800,
   0x26146862,
   0xd0e34232,
   0x7b524ac7,
   0x60220212,
   0x22084bc6,
   0x4bc6601a,
   0x6248601a,
   0xbdf02001,
   0x19c00098,
   0x64086880,
   0xbdf02000,
   0x460148c1,
   0x7bca3120,
   0x76823060,
   0x73c82002,
   0x470048be,
   0x314049bc,
   0x28267108,
   0xdc12d038,
   0xd02f2809,
   0x2800dc08,
   0x2801d028,
   0x2804d020,
   0x2808d020,
   0xe023d117,
   0xd02b2815,
   0xd023281b,
   0xd110281f,
   0x2838e022,
   0xdc06d016,
   0xd0152831,
   0xd0152835,
   0xd1062836,
   0x283be014,
   0x283dd00a,
   0x2847d01a,
   0x49aad016,
   0x18400080,
   0x47706880,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x477048a8,
   0x4c9ab5f0,
   0x4621b085,
   0x91033120,
   0x21447bce,
   0x29075d09,
   0x2934d001,
   0x4625d17e,
   0x786a3580,
   0xd07a2a00,
   0x06897d21,
   0x498dd577,
   0x468e3180,
   0x2e017f09,
   0x0709d028,
   0x004b0f09,
   0x2301702b,
   0x469c025b,
   0x93002300,
   0x29009302,
   0x0993d030,
   0x07db4f94,
   0x7f3bd00b,
   0xd0012b00,
   0x401a23f7,
   0x33204b90,
   0x2b00781b,
   0x23efd001,
   0x0693401a,
   0x2b070f5b,
   0x08d3d00b,
   0xd00c07db,
   0x767a2200,
   0x321c4a88,
   0xe0139200,
   0x70290909,
   0x2201e7d7,
   0x46940292,
   0x0912e7f2,
   0xd00807d2,
   0x767a2201,
   0x32204a80,
   0x22019200,
   0x92020252,
   0x2100e000,
   0x23074a69,
   0x63d33a40,
   0x4a672322,
   0x421a6852,
   0x4a65d0fb,
   0x6b523a40,
   0x61da4b77,
   0x693b4f77,
   0x43932210,
   0x4b76613b,
   0x0792695a,
   0x4a74d1fc,
   0x68123240,
   0x06d370aa,
   0x1e9a0edb,
   0xd3002a13,
   0x46222302,
   0x92013260,
   0x76d33008,
   0xd0552900,
   0x7f7f4677,
   0x469600da,
   0x2a041bd2,
   0x2204da00,
   0xd0242e01,
   0xe0010093,
   0xe04fe053,
   0x330e4e65,
   0x467362b3,
   0x484c181b,
   0x62033840,
   0x4617434a,
   0xdd004562,
   0x48604667,
   0x60419902,
   0x19c99902,
   0x60811e49,
   0x22216801,
   0x60014311,
   0x1c766a26,
   0x62666226,
   0x7bc09803,
   0xd0062801,
   0x00d6e009,
   0x36164f54,
   0x011b62be,
   0x4954e7dc,
   0xf7ff483a,
   0x2e02face,
   0x78aadd06,
   0x98004639,
   0xf85cf000,
   0xe00f2102,
   0x98004639,
   0xfd40f7ff,
   0x3140494b,
   0x9a016ac9,
   0x210077d1,
   0xd0002e01,
   0xf7ff2108,
   0x2103fca6,
   0x77819801,
   0xbdf0b005,
   0x21019a01,
   0x6a217791,
   0x62211c49,
   0xe0026261,
   0x34602100,
   0x4a3c77a1,
   0x62912100,
   0x39404923,
   0x98036208,
   0x28017bc0,
   0x4820d1e8,
   0x06c968c1,
   0x2100d5fc,
   0x29021c49,
   0x4935dbfc,
   0xfa91f7ff,
   0x481fe7dc,
   0x4601b510,
   0x460a3160,
   0x232f7e89,
   0x29025419,
   0x7d01d010,
   0xd5130689,
   0x29016a01,
   0x6ec1dd10,
   0x06c97849,
   0x1e8b0ec9,
   0xd8092b12,
   0x1e5b7d43,
   0xe0067543,
   0xfa82f7ff,
   0xd0002800,
   0xbd102001,
   0x76d12100,
   0xbd102000,
   0x33804b20,
   0x7083695b,
   0x22017042,
   0x42910252,
   0x2102dd03,
   0x71017001,
   0x21014770,
   0x47707001,
   0x40045080,
   0x0000ffff,
   0x21000048,
   0xe000e280,
   0xe000e100,
   0x21000160,
   0x00020f47,
   0x00025500,
   0x21004919,
   0x21004813,
   0x21004785,
   0x2100472b,
   0x21004679,
   0x21004459,
   0x21004259,
   0x210042c1,
   0x21004263,
   0x21004335,
   0x210043b7,
   0x21000000,
   0x40042100,
   0x400451c0,
   0x40042000,
   0x40045300,
   0x40048000,
   0x40046000,
   0x490cb510,
   0x4a0c4788,
   0x5e512106,
   0xd0072900,
   0xd0052902,
   0xd0032909,
   0xd0012910,
   0xd1072911,
   0x43c92177,
   0xdd014288,
   0xdd012800,
   0x43c0207f,
   0x0000bd10,
   0x000065a9,
   0x21000380,
   0x4810b510,
   0x481088c1,
   0xd0182905,
   0x68214c0f,
   0x0052084a,
   0x6ba26022,
   0x00520852,
   0x602163a2,
   0xfa52f7ff,
   0x07006ba0,
   0x2001d408,
   0x60606020,
   0x1c402000,
   0xdbfc280c,
   0x62202014,
   0xf7ffbd10,
   0xbd10fa43,
   0x21000380,
   0x00005b3f,
   0x40046000,
   0x490c6b80,
   0x0f000700,
   0x47707148,
   0x490a4a09,
   0x79502318,
   0x7e4956cb,
   0x428118c0,
   0x4608dd01,
   0x280fe002,
   0x200fdd00,
   0x090989d1,
   0x43010109,
   0x477081d1,
   0x210002e0,
   0x21000088,
   0x47702000,
   0x4b252201,
   0x48232102,
   0xb5104718,
   0x47804823,
   0x6a404823,
   0xd10d2800,
   0x200a4922,
   0x28005608,
   0x1c40da09,
   0x4608d007,
   0x6a403820,
   0x4288491e,
   0x4780d100,
   0xf7ffbd10,
   0xbd10ffe3,
   0x4b1c2100,
   0x46084a1a,
   0x481b4718,
   0x780122fb,
   0x70014011,
   0x38ec4812,
   0xb5104700,
   0x47884917,
   0x39204911,
   0xd0072801,
   0xd5040402,
   0x85082000,
   0x62484813,
   0xbd102001,
   0x4b096a4a,
   0x429a3bec,
   0x4a10d101,
   0x4907e005,
   0x4b0f6a4a,
   0xd1f2429a,
   0x624a4a0e,
   0x0000bd10,
   0x00000806,
   0x0000069f,
   0x000292a1,
   0x21000108,
   0x21000154,
   0x00029263,
   0x21004d4b,
   0x0002b4b5,
   0x21000380,
   0x000296f7,
   0x21004d41,
   0x21004d87,
   0x00029569,
   0x21004d7d,
   0x07810882,
   0x0ec90092,
   0x78c0ca0c,
   0x424940ca,
   0x408b3120,
   0x0211431a,
   0x06000a09,
   0x47704308,
};
#define _NWORD_PATCHIMAGE_MULTI_PROTOCOL_RTLS 888

CPE_PATCH_TYPE patchCpeHd[] = {
   0x00000000,
};
#define _NWORD_PATCHCPEHD_MULTI_PROTOCOL_RTLS 1

#define _NWORD_PATCHSYS_MULTI_PROTOCOL_RTLS 0



#ifndef _MULTI_PROTOCOL_RTLS_SYSRAM_START
#define _MULTI_PROTOCOL_RTLS_SYSRAM_START 0x20000000
#endif

#ifndef _MULTI_PROTOCOL_RTLS_CPERAM_START
#define _MULTI_PROTOCOL_RTLS_CPERAM_START 0x21000000
#endif

#define _MULTI_PROTOCOL_RTLS_SYS_PATCH_FIXED_ADDR 0x20000000

#define _MULTI_PROTOCOL_RTLS_PATCH_VEC_ADDR_OFFSET 0x03D0
#define _MULTI_PROTOCOL_RTLS_PATCH_TAB_OFFSET 0x03D4
#define _MULTI_PROTOCOL_RTLS_IRQPATCH_OFFSET 0x0480
#define _MULTI_PROTOCOL_RTLS_PATCH_VEC_OFFSET 0x404C

#define _MULTI_PROTOCOL_RTLS_PATCH_CPEHD_OFFSET 0x04E0

#ifndef _MULTI_PROTOCOL_RTLS_NO_PROG_STATE_VAR
static uint8_t bMultiProtocolRtlsPatchEntered = 0;
#endif

PATCH_FUN_SPEC void enterMultiProtocolRtlsCpePatch(void)
{
#if (_NWORD_PATCHIMAGE_MULTI_PROTOCOL_RTLS > 0)
   uint32_t *pPatchVec = (uint32_t *) (_MULTI_PROTOCOL_RTLS_CPERAM_START + _MULTI_PROTOCOL_RTLS_PATCH_VEC_OFFSET);

   memcpy(pPatchVec, patchImageMultiProtocolRtls, sizeof(patchImageMultiProtocolRtls));
#endif
}

PATCH_FUN_SPEC void enterMultiProtocolRtlsCpeHdPatch(void)
{
#if (_NWORD_PATCHCPEHD_MULTI_PROTOCOL_RTLS > 0)
   uint32_t *pPatchCpeHd = (uint32_t *) (_MULTI_PROTOCOL_RTLS_CPERAM_START + _MULTI_PROTOCOL_RTLS_PATCH_CPEHD_OFFSET);

   memcpy(pPatchCpeHd, patchCpeHd, sizeof(patchCpeHd));
#endif
}

PATCH_FUN_SPEC void enterMultiProtocolRtlsSysPatch(void)
{
}

PATCH_FUN_SPEC void configureMultiProtocolRtlsPatch(void)
{
   uint8_t *pPatchTab = (uint8_t *) (_MULTI_PROTOCOL_RTLS_CPERAM_START + _MULTI_PROTOCOL_RTLS_PATCH_TAB_OFFSET);


   pPatchTab[21] = 0;
   pPatchTab[1] = 1;
   pPatchTab[18] = 2;
   pPatchTab[81] = 3;
   pPatchTab[26] = 4;
   pPatchTab[76] = 5;
   pPatchTab[62] = 6;
   pPatchTab[64] = 7;
   pPatchTab[91] = 8;
   pPatchTab[79] = 9;
   pPatchTab[140] = 10;
   pPatchTab[150] = 11;
   pPatchTab[13] = 12;
   pPatchTab[31] = 13;
   pPatchTab[152] = 14;
   pPatchTab[151] = 15;
   pPatchTab[40] = 16;
   pPatchTab[73] = 17;
   pPatchTab[164] = 18;
}

PATCH_FUN_SPEC void applyMultiProtocolRtlsPatch(void)
{
#ifdef _MULTI_PROTOCOL_RTLS_NO_PROG_STATE_VAR
   enterMultiProtocolRtlsSysPatch();
   enterMultiProtocolRtlsCpePatch();
#else
   if (!bMultiProtocolRtlsPatchEntered)
   {
      enterMultiProtocolRtlsSysPatch();
      enterMultiProtocolRtlsCpePatch();
      bMultiProtocolRtlsPatchEntered = 1;
   }
#endif
   enterMultiProtocolRtlsCpeHdPatch();
   configureMultiProtocolRtlsPatch();
}

void refreshMultiProtocolRtlsPatch(void)
{
   enterMultiProtocolRtlsCpeHdPatch();
   configureMultiProtocolRtlsPatch();
}

void cleanMultiProtocolRtlsPatch(void)
{
#ifndef _MULTI_PROTOCOL_RTLS_NO_PROG_STATE_VAR
   bMultiProtocolRtlsPatchEntered = 0;
#endif
}

void rf_patch_cpe_multi_protocol_rtls(void)
{
   applyMultiProtocolRtlsPatch();
}


//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif


